home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / TCL1 / CTCPSTRE / CTCPSTRE.H < prev   
Text File  |  1990-06-28  |  2KB  |  59 lines

  1. /****
  2.  * CTCPStream.h
  3.  *
  4.  *    TCP Internet Protocal class.
  5.  *
  6.  ****/
  7.  
  8. #define    _H_CTCPStream            /* Include this file only once */
  9. #define NIL    0L
  10. #include    <MacTCPCommonTypes.h>
  11. #include    <UDPPB.h>
  12. #include    <TCPPB.h>
  13. #include     <GetMyIPAddr.h>
  14. #include    <AddressXlation.h>
  15.  
  16. #define    Closed         0                /* connection states */
  17. #define    Listening     2
  18. #define    SYNReceived     4
  19. #define    SYNSent         6
  20. #define    Established     8
  21. #define    FINWait1    10
  22. #define    FINWait2    12
  23. #define    CloseWait    14
  24. #define    Closing        16
  25. #define    LastAck        18
  26. #define    TimeWait    20
  27.  
  28. struct CTCPStream : CObject {
  29.     TCPiopb             tcppb;
  30.     tcp_port             thePort;
  31.     struct     hostInfo    hp;
  32.     wdsEntry            wds[2];
  33.     Boolean                async;
  34.     char                *IOBuffer;
  35.     int                    buffsize;
  36.     int                    Activity;
  37.     byte                timeout;
  38.     OSErr                ourError;
  39.                 
  40.     void    ITCPStream(short size);                /* initialize a stream        */
  41.     void    Dispose(void);                        /* get rid of it            */
  42.     void    Listen(tcp_port port);                /* listen on a stream        */
  43.     void    Open(tcp_port port,char *host);        /* open a remote stream        */
  44.     void    Release(void);                        /* release the stream        */
  45.     int        State(void);                        /* get the state             */
  46.     void    Close(void);                        /* politely close stream    */
  47.     void    Write(char *srcBuff, short len);    /* write to the stream        */
  48.     void    Read(char *destBuff, short *len);    /* read from the stream     */
  49.     void    SetTimeOut(byte secs);                /* adjust the timeout value    */
  50.     
  51. /*    void    ASR(StreamPtr tcpStream,             Can't have an ASR routine as
  52.                 unsigned short eventCode,         a method! But here's how to
  53.                 Ptr userDataPtr,                 declare one in Think C.
  54.                 unsigned shortterminReason, 
  55.                 struct ICMPReport *icmpMsg);
  56.                 
  57. */
  58. };
  59.